<include file="public@header"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
<meta name="referrer" content="never">
</head>
<body>
<div class="layui-fluid js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('AdminWechat/index')}">{:lang('PORTAL_ADMINWECHAT_INDEX')}</a></li>
        <if condition="cmf_auth_check(cmf_get_current_admin_id(), 'portal/AdminWechat/add')">
        	<li><a href="{:url('AdminWechat/add')}">{:lang('PORTAL_ADMINWECHAT_ADD')}</a></li>
        </if>
        <li class="active"><a>{:lang('PORTAL_ADMINWECHAT_EDIT')}</a></li>
    </ul> 
    <div class="tab-content">
	<if condition="count($news['news_item']) gt 1">
		<ul class="nav nav-tabs">
		<!-- <foreach name="news.news_item" item="vo">
			<li <if condition="$key eq 0">class="active"</if>><a href="#a{$key}" data-toggle="tab">第{$key+1}篇素材</a></li>
		</foreach> -->
		</ul>
	</if>
	<foreach name="news.news_item" item="vo">
        <div class="tab-pane <if condition="$key eq 0">active</if>" id="a{$key}">
			<form action="{:url('AdminWechat/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
				<div class="row">
					<div class="col-md-9">
						<table class="table table-bordered">

							<tr>
								<th width="100">标题<span class="form-required">*</span></th>
								<td>
									<input type="hidden" name="media_id" value="{$Request.param.id}"> 
									<input type="hidden" name="index" value="{$key}"> 
									<input class="layui-input" type="text" name="title"
										   required value="{$vo['title']}" placeholder="请输入标题"/>
								</td>
							</tr>

							<tr>
								<th width="100">作者</th>
								<td>
									<input class="layui-input" type="text" name="author"
										   value="{$vo['author']}" placeholder="请输入文章作者">
								</td>
							</tr>

							<tr>
								<th width="100">摘要</th>
								<td>
									<input class="layui-input" type="text" name="digest"
										   value="{$vo['digest']}" placeholder="请输入摘要">
								</td>
							</tr>



							<tr>
								<th width="100">转向链接</th>
								<td>
									<input class="layui-input" type="text" name="content_source_url" value="{$vo['content_source_url']}" placeholder="http://">
										   <p class="layui-word-aux">可跳转到指定地址</p>
									
								</td>
							</tr>

							<tr>
								<th width="100">内容</th>
								<td>
									<script type="text/plain" id="content{$key}"  style="width:510px;height:731px" name="content">{$vo['content']}</script>                             
								</td>
							</tr>
	 
						</table>
						<div class="layui-form-item">
							<div class="layui-col-smoffset-2 layui-col-sm10">
								<button type="submit" class="layui-btn layui-btn-normal js-ajax-submit">{:lang('SAVE')}</button>
								<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
							</div>
						</div>
					</div>
					<div class="col-md-3">
						<table class="table table-bordered">
							<tr>
								<th>缩略图</th>
							</tr>
							<tr>
								<td>
									<div style="text-align: center;" class="upload-image">
										<input type="hidden" name="thumb_url" id="thumbnail" value="">
										<input type="hidden" name="thumb_media_id" id="thumbnail" value="{$vo['thumb_media_id']}">
										<a href="javascript:uploadOneImage('图片上传','#thumbnail');">
											<if condition="empty($vo['thumb_url'])">
												<img src="__TMPL__/public/assets/images/default-thumbnail.png"
													 id="thumbnail-preview" width="135"
													 style="cursor: pointer"/>
												<else/>
												<img src="{$vo['thumb_url']}"  id="thumbnail-preview" width="135" style="cursor: pointer"/>
											</if>
										</a>
										<input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
										<p class="layui-word-aux">建议尺寸 900px * 500px</p>
									</div>
								</td>
							</tr>
							
							<tr>
								<th>是否打开评论</th>
							</tr>
							<tr>
								<td>
									<select class="layui-input" name="need_open_comment" id="more-template-select1">
										<option <if condition="!isset($vo['need_open_comment'])  or $vo['need_open_comment'] eq 0 ">selected</if> value="0">不打开</option>
										<option <if condition="isset($vo['need_open_comment']) and $vo['need_open_comment'] eq 1 ">selected</if> value="1">打开</option>
									</select>
								</td>
							</tr>
							
							<tr>
								<th>是否粉丝才可评论</th>
							</tr>
							<tr>
								<td>
									<select class="layui-input" name="only_fans_can_comment" id="more-template-select2">
										<option <if condition="isset($vo['only_fans_can_comment']) and $vo['only_fans_can_comment'] eq 0 ">selected</if> value="0">所有人可评论</option>
										<option <if condition="!isset($vo['only_fans_can_comment'])  or $vo['only_fans_can_comment'] eq 1 ">selected</if> value="1">粉丝才可评论</option>
									</select>
								</td>
							</tr>

							
						</table>
					</div>
				 </div>   
			</form>  
        </div>
        </foreach>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    $(function () {
	<foreach name="news.news_item" item="vo">
        var ue = UE.getEditor('content{$key}',
			{
				initialFrameWidth : 510,
				catchRemoteImageEnable: true,
				imagePopup:true ,
				imageUrlPrefix:'{$Think.server.http_host}' ,
				toolbars:[
					["undo", "redo", "|", "fontsize", "blockquote", "|", "removeformat", "formatmatch", "|", "link", "emotion", "spechars", "superscript", "subscript", "|", "PastePlain", "directionalityltr", "directionalityrtl", "|", "touppercase", "tolowercase"],
					["bold", "italic", "underline", "forecolor", "shadowcolor", "backcolor", "|", "indent", "lineheight", "letterspacing", "outpadding", "rowspacingtop", "rowspacingbottom", "|", "justifyleft", "justifycenter", "justifyright", "justifyjustify"],
					["insertorderedlist", "insertunorderedlist", "|", "autotypeset", "background", "horizontal", "searchreplace","music", "|", "source","|","insertimage"]
				]
			}
		);
	</foreach>
        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

        $('#more-template-select').val("{$post.more.template|default=''}");
    });

    


</script>
</body>
</html>
